
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AudioManager : MonoBehaviour
{

    public static AudioManager Instance { get; private set; }
    private void Awake()
    {
        Instance = this;
    }
    public AudioClip birdCollsion;
    public AudioClip birdSelect;    
    public AudioClip birdFlying;
    public AudioClip[] pigCollsion;
    public AudioClip woodCollsion;
    public AudioClip woodDestoryed;
    public AudioClip BGM;
    // Start is called before the first frame update
    public void PlayBirdCollsion(Vector3 p)
    {
        AudioSource.PlayClipAtPoint(birdCollsion, p,1f);
    }
    public void PlayBirdSelect(Vector3 p)
    {
        AudioSource.PlayClipAtPoint(birdSelect, p, 1f);
    }
    public void PlayBirdFlying(Vector3 p)
    {
        AudioSource.PlayClipAtPoint(birdFlying, p, 1f);
    }
    public void PlayPigCollsion(Vector3 p)
    {
        int randomIndex=Random.Range(0, pigCollsion.Length);
        AudioSource.PlayClipAtPoint(pigCollsion[randomIndex], p, 1f);
    }
    public void PlayWoodCollsion(Vector3 p)
    {
        AudioSource.PlayClipAtPoint(woodCollsion, p, 1f);
    }
    public void PlayWoodDestory(Vector3 p)
    {
        AudioSource.PlayClipAtPoint(woodDestoryed, p, 1f);
    }
}
